package sort

// HeapSort 最直观的堆排序
func HeapSort(data []int) {

	heap, _ := NewMaxHeap()
	for i := 0; i < len(data)-1; i++ {
		heap.Add(data[i])
	}

	for i := len(data) - 1; i >= 0; i-- {
		value, _ := heap.ExtractMax()
		data[i] = value
	}
}
